home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 12: Textmags & Docs / nf_archive_12.iso / MAGS / SOURCES / ATARI_SRC.ZIP / atari source / AHDI / CHNLTST / BLITTER.S < prev    next >
Encoding:
Text File  |  2001-02-09  |  2.2 KB  |  83 lines

  1. ;+
  2. ; initblit() - initialize the BLiTTER chip for 512 bytes I/O transfer
  3. ;
  4. ; Passed:
  5. ;    a0.l = destination address if read; source address if write
  6. ;    d0.w = flag to tell whether it's a read or a write
  7. ;-
  8. initblit:
  9.     lea    bBLiTTER,a1        ; a1 -> BLiTTER register map
  10.     tst.b    d0            ; read or write?
  11.     bne.s    ib0            ; (write)
  12.     move.l    #IDEDR,SRCADDR(a1)    ; source addr = IDE data register
  13.     move.l    a0,DESTADDR(a1)        ; destination addr = given buffer
  14.     move.w    #2,DESTXINC(a1)        ; words read
  15.     moveq    #0,d0
  16.     move.w    d0,SRCXINC(a1)        ; never increment source X
  17.     bra.s    ib1
  18.                     ; initialize BLiTTER to write to disk
  19. ib0:    move.l    a0,SRCADDR(a1)        ; source addr = write buffer
  20.     move.l    #IDEDR,DESTADDR(a1)    ; destination addr = IDE data reg
  21.     move.w    #2,SRCXINC(a1)        ; words write
  22.     moveq    #0,d0
  23.     move.w    d0,DESTXINC(a1)        ; never increment destination X
  24.  
  25. ib1:    move.w    d0,SRCYINC(a1)        ; never increment source Y
  26.     move.w    d0,DESTYINC(a1)        ; never increment destination Y
  27.     move.b    d0,SKEW(a1)        ; no skew
  28.     moveq    #$ff,d0
  29.     move.l    d0,ENDMASK1(a1)        ; change all bits at destination
  30.     move.w    d0,ENDMASK3(a1)        ; change all bits at destination
  31.     move.w    #$203,HOP(a1)        ; set HOP and OP to source
  32.     move.w    #256,XCNT(a1)        ; num of words to transfer
  33.     rts
  34.  
  35.  
  36. ;+
  37. ; restart() - restart the BLiTTER
  38. ;
  39. ; Passed:
  40. ;    a1.l = base address of BLiTTER
  41. ;-
  42. restart:
  43.     nop
  44.     tas    BUSY(a1)    ; restart BLiTTER and test if busy
  45.     bmi.s    restart        ; quit if not busy
  46.     rts
  47.  
  48.  
  49. ;+
  50. ; readbuf() - reads 512 bytes (128 longs) of data from the sector
  51. ;        buffer.
  52. ;
  53. ; Comments:
  54. ;    A tower of 8 move.l is used to try to speed up the transfer.
  55. ;
  56. ; Passed:
  57. ;    a0.l = buffer to store data read from sector buffer
  58. ;
  59. ;    if BLiTTER code
  60. ;    a1.l = base address of BLiTTER
  61. ;-
  62. readbuf:
  63.     move.w    #1,YCNT(a1)    ; one destination line
  64.     move.b    #$80,BUSY(a1)    ; start the BLiTTER
  65.     bsr    restart
  66.     addq.l    #2,DESTADDR(a1)    ; advance to next word of destination
  67.     rts
  68.  
  69.  
  70. ;+
  71. ; wrtbuf() - writes 512 bytes (128 longs) of data to sector buffer.
  72. ;
  73. ; Passed:
  74. ;    a0.l = buffer with data to write to sector buffer
  75. ;-
  76. wrtbuf:
  77.     move.w    #1,YCNT(a1)    ; one destination line
  78.     move.b    #$80,BUSY(a1)    ; start the BLiTTER
  79.     bsr    restart
  80.     addq.l    #2,SRCADDR(a1)    ; advance to next word of source
  81.     rts
  82.  
  83.